feat(www): add rss and atom feeds#4495
Conversation
|
|
Cool! @Barsnes is busy today, but I think its best he has a look at this since he's our react router expert :D In the meantime could you please fix the formating/sort errors? :) |
101dba4 to
cab6625
Compare
| const dayStrings = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; | ||
| const monthStrings = [ | ||
| 'Jan', | ||
| 'Feb', | ||
| 'Mar', | ||
| 'Apr', | ||
| 'May', | ||
| 'Jun', | ||
| 'Jul', | ||
| 'Aug', | ||
| 'Sep', | ||
| 'Oct', | ||
| 'Nov', | ||
| 'Dec', | ||
| ]; |
There was a problem hiding this comment.
I think it would be better to use Intl.DateTimeFormat here
see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
There was a problem hiding this comment.
Thanks for the tip! I used Intl.DateTimeFormat to get the day/month name, but still keeping the whole file for the RFC-882-ness of it all :P
| @@ -1,4 +1,4 @@ | |||
| import en from '@internal/components/src/_locales/en'; | |||
There was a problem hiding this comment.
Any reason for changing this?
We have @internal/components installed as a package in www
There was a problem hiding this comment.
No. Reverted the change
| import i18n from './i18n'; | ||
| import en from './locales/en'; | ||
| import no from './locales/no'; |
There was a problem hiding this comment.
The build process doesn't like it when these use path aliases
It's also why I changed @internal/components, but that's actually not a path alias and works as expected. So I'll revert that
$ pnpm build:www
> root@0.0.0 build:www /home/luca/git_clones/designsystemet
> pnpm --filter @web/www build
> @web/www@ build /home/luca/git_clones/designsystemet/apps/www
> react-router typegen && react-router build
Error: Error loading /home/luca/git_clones/designsystemet/apps/www/react-router.config.ts: Error: Cannot find module '~/i18n' imported from '/home/luca/git_clones/designsystemet/apps/www/app/i18next.server.ts'
at createConfigLoader (/home/luca/git_clones/designsystemet/node_modules/.pnpm/@react-router+dev@7.13.0_@types+node@24.10.9_jiti@2.4.2_less@4.3.0_lightningcss@1.30.1__da506b19369c0bc5234f64cfdd1fd83c/node_modules/@react-router/dev/dist/vite.js:625:11)
at BasicMinimalPluginContext.config (/home/luca/git_clones/designsystemet/node_modules/.pnpm/@react-router+dev@7.13.0_@types+node@24.10.9_jiti@2.4.2_less@4.3.0_lightningcss@1.30.1__da506b19369c0bc5234f64cfdd1fd83c/node_modules/@react-router/dev/dist/vite.js:3236:35)
at runConfigHook (file:///home/luca/git_clones/designsystemet/node_modules/.pnpm/vite@7.3.1_@types+node@24.10.9_jiti@2.4.2_less@4.3.0_lightningcss@1.30.1_sass@1.87.0_st_96f85193d5e7f20965a220e556791264/node_modules/vite/dist/node/chunks/config.js:35936:15)
at Module.resolveConfig (file:///home/luca/git_clones/designsystemet/node_modules/.pnpm/vite@7.3.1_@types+node@24.10.9_jiti@2.4.2_less@4.3.0_lightningcss@1.30.1_sass@1.87.0_st_96f85193d5e7f20965a220e556791264/node_modules/vite/dist/node/chunks/config.js:35438:13)
at hasReactRouterRscPlugin (/home/luca/git_clones/designsystemet/node_modules/.pnpm/@react-router+dev@7.13.0_@types+node@24.10.9_jiti@2.4.2_less@4.3.0_lightningcss@1.30.1__da506b19369c0bc5234f64cfdd1fd83c/node_modules/@react-router/dev/dist/cli/index.js:1355:22)
at typegen (/home/luca/git_clones/designsystemet/node_modules/.pnpm/@react-router+dev@7.13.0_@types+node@24.10.9_jiti@2.4.2_less@4.3.0_lightningcss@1.30.1__da506b19369c0bc5234f64cfdd1fd83c/node_modules/@react-router/dev/dist/cli/index.js:2392:15)
at run2 (/home/luca/git_clones/designsystemet/node_modules/.pnpm/@react-router+dev@7.13.0_@types+node@24.10.9_jiti@2.4.2_less@4.3.0_lightningcss@1.30.1__da506b19369c0bc5234f64cfdd1fd83c/node_modules/@react-router/dev/dist/cli/index.js:2575:7)
/home/luca/git_clones/designsystemet/apps/www:
ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @web/www@ build: `react-router typegen && react-router build`
Exit status 1
ELIFECYCLE Command failed with exit code 1.cab6625 to
df97a30
Compare
resolves #4492
Summary
Generate RSS and Atom feeds at build time for the blog on the main designsystemet.no website for all available languages. Strongly inspired by how sitemap.xml is generated, as well as many helper functions copied all over github and stackoverflow
In addition these feeds have been checked with https://validator.w3.org/feed/ and should be valid
Lastly, I couldn't get react router to build when using path aliases, so some stuff had to be changed to be relative links unfortunately
Checks
pnpm changesetif relevant)